Ext.namespace("Plan.Content");

Plan.Content.win = function(){
	this.store;
	this.rowIndex;
	this.columnIndex;
	
	this.content =  new Ext.form.HtmlEditor({
		width:530,
		height:400,
		allowBlank: false,
		autoScroll:true
	});
	this.btnSave = new Ext.Button({
		text:'确定',
		scope:this,
		handler:this.setContent
		
	})
	Plan.Content.win.superclass.constructor.call(this,{
		title:'计划内容',
	    closeAction: 'hide',
	    modal:true,
	   	frame:true,
	    width:550,
		height:400,
		items:[this.content],
		buttonAlign:'center',
		buttons:[this.btnSave,{text:'关闭',handler:function(){this.hide()},scope:this}]
	});
}
Ext.extend(Plan.Content.win,Ext.Window,{
	initContent:function(store,rowIndex,columnIndex){
		this.store=store;
		this.rowIndex=rowIndex;
		this.columnIndex=columnIndex;
		this.content.setValue()
		for(var i=0;i<store.getCount();i++){
			var rowData = store.getAt(i).data;
			if(i==this.rowIndex){
				this.content.setValue(rowData.PLAN_ITEM_CONTENT)
			}
		}
	},
	setContent:function(){
		var store = this.store;
		var data =[];
		for(var i=0;i<store.getCount();i++){
			var rowData = store.getAt(i).data;
			if(i==this.rowIndex){
				rowData.PLAN_ITEM_SUBCONTENT=Utils.getSubHTMLData(this.content.getValue(),40);
				rowData.PLAN_ITEM_CONTENT=this.content.getValue();
			}
			data.push(rowData);
		}
		store.loadData(data);
		this.hide();
	}
})